<template>
	<view class="page">

		<qsTab ref="tabs" :tabs="tabs" animationMode="line1" :current="current" :minWidth='375' @change="tabChange"
			swiperWidth="750">
		</qsTab>
		<groupInfo :manageInfo="manageInfo" :userList="userList" :flag="flag" v-show="current == 0" />
		<groupMember :manageInfo="manageInfo" @addUserList="addUserList" :flag="flag" v-show="current == 1" />
	</view>
</template>

<script>
	import qsTab from '../../components/QS-tabs/QS-tabs.vue'
	import groupInfo from "./groupInfo.vue"
	import groupMember from "./groupMember.vue"
	export default {
		components: {
			qsTab,
			groupInfo,
			groupMember,
		},
		onLoad(option) {
			this.flag = option.flag
			if(this.flag == 1){
				this.manageInfo = uni.getStorageSync("editManage")
				this.userList = this.manageInfo.userList
			}else{
				uni.setStorage({
					key: 'editManage',
					data: {},
					success: function() {
						// console.log('success');
					}
				});
			}
		},
		methods: {
			initInfo(){
				this.manageInfo = JSON.stringify(res.data.data)
			}
		},
		data() {
			return {
				// 当前tabIndex
				flag:0,
				current: 0,
				manageInfo:{},
				tabs: [{
						name: '班组信息'
					},
					{
						name: '班组成员'
					}
				],
				userList:[]
			}
		},
		methods: {
			/**
			 * 选显卡切换
			 * */
			tabChange(index) {
				this.current = index
			},
			addUserList(e){
				this.manageInfo.userList = e
				this.userList = e
			}
		}
	}
</script>

<style scoped lang="scss">

</style>
